package com.cloud.cloudvideo.service.impl;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.cloudvideo.entity.SysMenuPo;
import com.cloud.cloudvideo.entity.SysUserRoleInfoPo;
import com.cloud.cloudvideo.mapper.SysUserMapper;
import com.cloud.cloudvideo.service.LoginService;

@Service
public class LoginServiceImpl implements LoginService {

	@Autowired
	private SysUserMapper sysUserMapper;
	
	
	
	@Override
	public SysUserRoleInfoPo getUserByName(String name) {
		SysUserRoleInfoPo pojo = sysUserMapper.getUserRoleInfo(name);
		return pojo;
	}



	@Override
	public Map<String, Object> menulist(Long id) {
		Map<String, Object> map = new HashMap<String,Object>();
		
		
		/*
		 * "homeInfo": {
				"title": "首页",
				"href": "/manager/welcome-1.html?t=1"
			},
		 */
		Map<String, Object> homemap = new HashMap<String,Object>();
		homemap.put("title", "首页");
		homemap.put("href", "/manager/welcome-1.html?t=1");
		map.put("homeInfo", homemap);
		/*
		 * "logoInfo": {
				"title": "LAYUI MINI",
				"image": "/manager/images/logo.png",
				"href": ""
			},
		 */
		Map<String, Object> logomap = new HashMap<String,Object>();
		logomap.put("title", "NIIT");
		logomap.put("image", "/manager/images/logo.png");
		logomap.put("href", "");
		map.put("logoInfo", logomap);
		
		List<SysMenuPo> menu = sysUserMapper.getUserMenuByUid(id);
		SysMenuPo menu1 = new SysMenuPo("常规管理", "", "fa fa-address-book", "_self", menu);
		List<SysMenuPo> list = Arrays.asList(menu1);
		map.put("menuInfo", list);
	
		
		return map;
	}
	
	
	
}
